#ifndef	_INPUT_SEQUENCES_H_
#define _INPUT_SEQUENCES_H_

#include <fstream>
#include <vector>
#include "InputSequence.h"

using namespace std;

/* Reads a given stream Buffer after Buffer, and creates the relevant input sequences from it. */
class InputSequences
{
  private:
	vector<InputSequence> sequences;
	//static const int BUFFER_SIZE = 4096;
	static const int BUFFER_SIZE = 26;
	
	/* when reading the sequences in a file one by one, 
		we need the following fields to save intermediate state */
	ifstream *in;
	
	/* indicator wether addOneSequence was called before */
	bool firstSeq;
	bool doneReadingFile;
	streamsize bytesRead;
	char buffer[BUFFER_SIZE];
	int buffPos;
	string nextName;
	
  public:
//	InputSequences();
	InputSequences(ifstream *in);

	~InputSequences();
	
	void addOneSequence();
	
	void addSequences();

	uint getSequencesNum() const;
	
	InputSequence getLastSequence() const;
	
	InputSequence getSequence(int index) const;

	inline bool doneReading() const;

#ifdef DEBUG
	void print() const;
#endif

};

inline bool InputSequences::doneReading() const
{
	return (buffPos >= bytesRead && in->eof());
}

#endif /* _INPUT_SEQUENCES_H_ */

